module.exports = {
  productionSourceMap: false,
  lintOnSave: false,
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  devServer: {
    historyApiFallback: true,
    proxy: {
      '/api': {
         target: "http://localhost:7111",
        changeOrigin: true,
        ws: false,
        pathRewrite: {
          '^/api': ''
        }
      },
      '/lsb': {
        target: "http://localhost:7111",
        changeOrigin: true,
        ws: false,
        pathRewrite: {
          '^/lsb': ''
        }
      }
    },
  },

  chainWebpack: config => {
    config
      .entry('index')
      .add('babel-polyfill')
      .end();
    // 生产环境配置
    if (process.env.NODE_ENV === 'production') {
      // 删除预加载
      config.plugins.delete('preload');
      config.plugins.delete('prefetch');
      // 压缩代码
      config.optimization.minimize(true);
    }
  }
}
